﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Xml.Serialization;
using Landpy.CruiseControlNet.Infrastructure.Control;

namespace Landpy.CruiseControlNet.FacadeInterface.ConfigurationModule
{
    public class Group : IPrimaryKey
    {
        [Browsable(false)]
        [XmlIgnore]
        public Guid Id { get; private set; }

        [Category("Basic")]
        [Description("The name of the group, which corresponds to the 'group' values used in the <user> elements.")]
        [XmlAttribute("name")]
        public string Name { get; set; }

        [Editor(typeof(MultipleTypeCollectionEditor), typeof(UITypeEditor))]
        [Category("Basic")]
        [Description("A list of notification types, determining when to send email to this group.")]
        [XmlArray("notifications")]
        [XmlArrayItem("notificationType", Type = typeof(NotificationType))]
        public List<NotificationType> Notifications { get; set; }

        public Group()
        {
            this.Notifications = new List<NotificationType>();
            this.Id = Guid.NewGuid();
        }
    }
}